package source_manager

var (
	repo        map[string]SourceManger
	defaultRepo SourceManger
)

func init() {
	repo = make(map[string]SourceManger)
}

func Register(key string, source SourceManger, setDefault bool) {
	repo[key] = source
	if setDefault {
		defaultRepo = source
	}
}

func GetSourceManager(key string) SourceManger {
	if s, ok := repo[key]; ok {
		return s
	}
	return defaultRepo
}

type SourceManger interface {
	GetHome(id string) (any, error)                           //int | string
	GetPage(id, limit, page string) (any, error) // for Category
	GetDetail(id string) (any, error)
	GetPlay(id string) (any, error)
}

// type Manger struct {
// }

// // sourcekey

// func (s *Manger) GetDetail(key string, id int) any {

// }
